from typing import Optional
from pydantic import BaseModel

class AirplaneBase(BaseModel):
    Code: str  # 机型代码
    Name: str  # 机型名称
    Description: Optional[str] = None
    Manufacturer: str
    Capacity: int
    Status: str = "active"  # active/inactive

    class Config:
        from_attributes = True

class AirplaneCreate(BaseModel):
    Code: str
    Name: str
    Description: Optional[str] = None
    Manufacturer: str
    Capacity: int
    Status: Optional[str] = "active"

class AirplaneUpdate(BaseModel):
    Name: Optional[str] = None
    Description: Optional[str] = None
    Manufacturer: Optional[str] = None
    Capacity: Optional[int] = None
    Status: Optional[str] = None

class Airplane(AirplaneBase):
    ID: int

    class Config:
        from_attributes = True 